<?php

namespace app\admin\controller;
use think\Controller;
use think\Request;
use app\admin\model\News;
use app\admin\model\Category;
use gmars\qiniu;
class Article extends Controller
{
  public function index(){
      $data= (new  News())->getList();
      return view('index',['data'=>$data]);
    
  }
  public function add(){

    $data=(new Category())->getList();

  	if ($this->request->isPost()) {

        $post = Request::instance()->post();
        $post['content']=$post['editorValue'];
        $res=(new News())->add($post);
        if($res){
            return view('index');
        }
  	}
  	return view('add',['data'=>$data]);
  }
  public function show(){
  	   return view();
  }
  
}